package simply.learn.hibernate.learn.example1;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

public class StudentDAO {

	private SessionFactory sessionFactory;
	
	public StudentDAO(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	
	public void saveStudent(Student student){
		Session session = sessionFactory.openSession();
		session.beginTransaction();
		session.save(student);
		session.getTransaction().commit();
	}
}
